package com.itheima.consumer.client;

import com.itheima.consumer.config.FeignConfig;
import com.itheima.consumer.fallback.UserClientBack;
import com.itheima.consumer.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

//声明当前类是一个Feign客户端，指定服务提供者的名称为user-service,并指定发生错误时调用的方法
@FeignClient(value = "user-service", fallback = UserClientBack.class,configuration = FeignConfig.class)
public interface UserClient { //框架会自动生成代理对象
    //http://user-service/user/123
    @GetMapping("/user/{id}") //请求路径
    User queryById(@PathVariable Long id);
}
